/*
* 领料单详细详情
* */

import 'package:center_beijing/api/material_science_api.dart';
import 'package:center_beijing/common/styles.dart';
import 'package:center_beijing/config/global_config.dart';
import 'package:center_beijing/widgets/custom_loading_widget.dart';
import 'package:center_beijing/widgets/imagesWatch_widget2.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:get/get.dart';
class MaterialRequisitionDetail extends StatefulWidget {
  @override
  _MaterialRequisitionDetailState createState() => _MaterialRequisitionDetailState();
}

class _MaterialRequisitionDetailState extends State<MaterialRequisitionDetail> with SingleTickerProviderStateMixin {
  AnimationController _controller;
  CustomLoading loading = CustomLoading.withMessage('请稍候...');
  var currentDetail = Get.arguments['pass'];
  var receive = Get.arguments['detail'];
  @override
  void initState() {
    _controller = AnimationController(vsync: this);
    super.initState();
  }

  @override
  void dispose() {
    _controller.dispose();
    loading.dismiss();
    super.dispose();
  }



  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('材料详情'),
      ),
      body: Container(
        color: Styles.MainBackgroundColor,
        padding:
        EdgeInsets.fromLTRB(0, 0, 0, MediaQuery.of(context).padding.bottom),
        child: SingleChildScrollView(
          child: Column(
            children: [
              Container(
                color: Colors.white,
                alignment: Alignment.centerLeft,
                padding: EdgeInsets.fromLTRB(Styles.spacing16, Styles.spacing8, Styles.spacing16, Styles.spacing8),
                child: Text('所属单号 ${this.currentDetail['requisitionDocNum']}'),
              ),
              Container(
                color: Colors.white,
                alignment: Alignment.centerLeft,
                padding: EdgeInsets.fromLTRB(Styles.spacing16, Styles.spacing8, Styles.spacing16, Styles.spacing8),
                child: Text('领用时间 ${this.receive['requestDateStr']}'),
              ),
              Container(
                color: Colors.white,
                alignment: Alignment.centerLeft,
                padding: EdgeInsets.fromLTRB(Styles.spacing16, Styles.spacing8, Styles.spacing16, Styles.spacing8),
                child: Text('领用类型 ${this.currentDetail['requestTypeCaption']}'),
              ),
              Container(
                color: Colors.white,
                alignment: Alignment.centerLeft,
                padding: EdgeInsets.fromLTRB(Styles.spacing16, Styles.spacing8, Styles.spacing16, Styles.spacing8),
                child: Text('发料仓库 ${this.receive['outHouseName']}'),
              ),
              Container(
                color: Colors.white,
                alignment: Alignment.centerLeft,
                padding: EdgeInsets.fromLTRB(Styles.spacing16, Styles.spacing8, Styles.spacing16, Styles.spacing8),
                child: Text('领料仓库 ${this.receive['requestCorpName']}'),
              ),
              Container(
                color: Colors.white,
                alignment: Alignment.centerLeft,
                padding: EdgeInsets.fromLTRB(Styles.spacing16, Styles.spacing8, Styles.spacing16, Styles.spacing8),
                child: Text('物资编码 ${this.currentDetail['materialSpecId']}'),
              ),
              Container(
                color: Colors.white,
                alignment: Alignment.centerLeft,
                padding: EdgeInsets.fromLTRB(Styles.spacing16, Styles.spacing8, Styles.spacing16, Styles.spacing8),
                child: Text('材料名称 ${this.currentDetail['specSimpleName']}'),
              ),
              Container(
                color: Colors.white,
                alignment: Alignment.centerLeft,
                padding: EdgeInsets.fromLTRB(Styles.spacing16, Styles.spacing8, Styles.spacing16, Styles.spacing8),
                child: Text('规格型号 ${this.currentDetail['specName']}'),
              ),
              Container(
                color: Colors.white,
                alignment: Alignment.centerLeft,
                padding: EdgeInsets.fromLTRB(Styles.spacing16, Styles.spacing8, Styles.spacing16, Styles.spacing8),
                child: Text('计量单位 ${this.currentDetail['measureUnit']}'),
              ),
              Container(
                color: Colors.white,
                alignment: Alignment.centerLeft,
                padding: EdgeInsets.fromLTRB(Styles.spacing16, Styles.spacing8, Styles.spacing16, Styles.spacing8),
                child: Text('领用单价 ${this.currentDetail['requestPrice']!=null?this.currentDetail['requestPrice']['value']:'--'}元'),
              ),

              Container(
                color: Colors.white,
                alignment: Alignment.centerLeft,
                padding: EdgeInsets.fromLTRB(Styles.spacing16, Styles.spacing8, Styles.spacing16, Styles.spacing8),
                child: Text('数量 ${this.currentDetail['requestQuantity']!=null?this.currentDetail['requestQuantity']['value']:'--'}'),
              ),
              Container(
                color: Colors.white,
                alignment: Alignment.centerLeft,
                padding: EdgeInsets.fromLTRB(Styles.spacing16, Styles.spacing8, Styles.spacing16, Styles.spacing8),
                child: Text('材料类型 ${this.currentDetail['materialType'] == '1' ? '周转材料' : '非周转材料'}'),
              ),
              Container(
                color: Colors.white,
                alignment: Alignment.centerLeft,
                padding: EdgeInsets.fromLTRB(Styles.spacing16, Styles.spacing8, Styles.spacing16, Styles.spacing8),
                child: Text('使用部位 ${this.currentDetail['elementName']!=null?this.currentDetail['elementName']:'--'}'),
              ),
              Container(
                color: Colors.white,
                alignment: Alignment.centerLeft,
                padding: EdgeInsets.fromLTRB(Styles.spacing16, Styles.spacing8, Styles.spacing16, Styles.spacing8),
                child: Text('金额 ${this.currentDetail['amount']!=null?this.currentDetail['amount']['value']:'--'}元'),
              ),
              Container(
                color: Colors.white,
                alignment: Alignment.centerLeft,
                padding: EdgeInsets.fromLTRB(Styles.spacing16, Styles.spacing8, Styles.spacing16, Styles.spacing8),
                child: Text('备注 ${this.currentDetail['remark']}'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
